import { http } from "@/utils/http";
import type { ResultProps } from "@/api/user";

export interface TpmVersionListProp {
  id: number;
  accountId: number;
  businessId: number;
  name: string;
  note: null;
  deleteStatus: number;
  publishStatus: null;
  publishTime: null;
  deviceType: string;
  moduleKey: string;
  updateTime: Date;
  createTime: Date;
  customParameters: null;
}

export const tpmVersionGetList = (data?: object) => {
  return http.requestJson<ResultProps<TpmVersionListProp[]>>(
    "post",
    "/tpmVersion/getList",
    {
      data
    }
  );
};

export const tpmVersionAdd = (data?: object) => {
  return http.requestJson<ResultProps<null>>("post", "/tpmVersion/add", {
    data
  });
};

export const tpmVersionUpd = (data?: object) => {
  return http.requestJson<ResultProps<null>>("post", "/tpmVersion/upd", {
    data
  });
};

export const tpmVersionDel = (data?: object) => {
  return http.requestJson<ResultProps<null>>("post", "/tpmVersion/del", {
    data
  });
};

export const tpmVersionPublish = (data?: object) => {
  return http.requestJson<ResultProps<null>>("post", "/tpmVersion/publish", {
    data
  });
};

export const tpmVersionRelease = (data?: object) => {
  return http.requestJson<ResultProps<null>>("post", "/tpmVersion/release", {
    data
  });
};

export const tpmVersionGetReleaseList = (data?: object) => {
  return http.requestJson<ResultProps<any>>(
    "post",
    "/tpmVersion/getReleaseList",
    {
      data
    }
  );
};

export interface TpmFormulaListProp {
  id: number;
  accountId: number;
  businessId: number;
  formulaId: string;
  formulaVersion: null;
  version: number;
  publishStatus: number;
  formulaSubid: string;
  name: string;
  icon: string;
  m1: string;
  m2: string;
  m3: string;
  m4: string;
  deviceType: string;
  note: string;
  deleteStatus: number;
  createTime: Date;
  updateTime: Date;
}

export const tpmFormulaAdd = (data?: object) => {
  return http.requestJson<ResultProps<TpmFormulaListProp>>(
    "post",
    "/tpmFormula/add",
    {
      data
    }
  );
};

export const tpmFormulaDel = (data?: object) => {
  return http.requestJson<ResultProps<TpmFormulaListProp>>(
    "post",
    "/tpmFormula/del",
    {
      data
    }
  );
};

export const tpmFormulaUpd = (data?: object) => {
  return http.requestJson<ResultProps<TpmFormulaListProp>>(
    "post",
    "/tpmFormula/upd",
    {
      data
    }
  );
};

export const tpmFormulaGetList = (data?: object) => {
  return http.requestJson<ResultProps<TpmFormulaListProp[]>>(
    "post",
    "/tpmFormula/getList",
    {
      data
    }
  );
};

export const tpmFormulaPublish = (data?: object) => {
  return http.requestJson<ResultProps<null>>("post", "/tpmFormula/publish", {
    data
  });
};
